<?php
/**
 *
 */
class Files extends Singleton {

	/**
	 * Enables singleton working properly
	 *
	 * @see singleton.php
	 */
	public static function instance() {
		return self::getInstanceOf( get_class() );
	}

	public static function get_list() {
		$path = MP_PATH . '/' . Config::instance()->get('files_directory');
		$files = FileSystemTools::list_files($path);
		$file_list = array();
		foreach($files as $file) {
			//unlink($file);
			$relative_file = str_replace(MP_PATH . '/', '', $file);
			$file_list[md5($relative_file)] = array(
				'file' => $relative_file,
				'last_modified' => filemtime($file)
			);
		}
		return $file_list;
	}
}